<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>模块管理</title> {{>/WEB-INF/pages/common/meta_base.part.html}}
{{>/WEB-INF/pages/common/refs_base.part.html}}
{{>/WEB-INF/pages/common/refs_modal.part.html}}
{{>/WEB-INF/pages/common/refs_plupload.part.html}}
</head>
<body>
	<!-- <div class="container"> -->
	{{>/WEB-INF/pages/common/layout_header.part.html}}

	<div class="container">
		<ul class="breadcrumb">
			<li><a href="{{ctx}}">首页</a></li>
			<li><a href="{{ctx}}/mam/widget/list-view">模块管理</a></li>
			<li class="active">{{widgetVO.name}}</li>
		</ul>

		<hr class="hr1" />
		<div class="hr-10"></div>
		<div class="bor-tab bg-st-white text-center">
			<div class="mar-st-a30">
				<div class="pad-st-b10 row">
					<div class="col-sm-12">
						<div class="pad-st-b2">
							<div class="text-left tit4-st col-sm-6">模块基本信息</div>
							<p class="btn-w text-right">
								<button class="btn btn-primary btn-small tls"
									onclick="deleteWidget('{{widgetVO.id}}')">删除</button>
								<button class="btn btn-primary btn-small tls"
									onclick="widgetEdit('{{widgetVO.id}}')">编辑</button>
							</p>
						</div>
						<div class="col-sm-2">
							<img style="width: 106px; height: 106px; cursor: pointer"
								class="img-rounded info-icon" id="widgetIcon" />
						</div>
						<script type="text/javascript">
							var icon_id = "{{widgetVO.icon_id}}";
							if (icon_id != "") {
								jQuery("#widgetIcon")
										.attr("src",
												"{{ctx}}/mam/attachment/download/{{widgetVO.icon_id}}");
							} else {
								jQuery("#widgetIcon").attr("src",
										"{{ctx}}/static/bsl/images/defind.png");
							}
						</script>
						<div class="col-sm-10 text-left">
							<ul class="list-li" style="width: 30%">
								<li>模块名称：{{widgetVO.name}}</li>
								<li>模块标识：{{widgetVO.identify}}</li>
								<li>模块类别：{{categoryVO.name}}</li>
								<li id="localWidget">客户端内置模块：<span id="localWidgetSpan"></span>
									<script type="text/javascript">
										var localstr = "{{widgetVO.local}}";
										if ("" != localstr) {
											jQuery("#localWidgetSpan")
													.text("是");
										} else {
											jQuery("#localWidgetSpan")
													.text("否");
										}
									</script>
								</li>
								<li id="appAuth">应用权限：<span id="appAuthSpan"></span>
									<script type="text/javascript">
										var localstr = "{{widgetVO.appAuth}}";
										if ("true" == localstr) {
											jQuery("#appAuthSpan")
													.text("是");
										} else {
											jQuery("#appAuthSpan")
													.text("否");
										}
									</script>
								</li>
								
								<li>创建时间：<script type="text/javascript">
									document.write($.format.date(
											"{{widgetVO.created_at}}",
											"yyyy-MM-dd HH:mm"))
								</script></li>
								<li>更新时间：<script type="text/javascript">
									document.write($.format.date(
											"{{widgetVO.modified_at}}",
											"yyyy-MM-dd HH:mm"))
								</script></li>
								<li>是否显示：<span id="mk_jbxx_cnt1"></span> <script
										type="text/javascript">
									var hidden = "{{widgetVO.hidden}}";
									if (hidden == "true") {
										jQuery("#mk_jbxx_cnt1").text("隐藏");
									} else {
										jQuery("#mk_jbxx_cnt1").text("显示");

									}
								</script>
								</li>
								<li id="autoDownloadLi">是否自动下载：<span id="autoDownload"></span>
									<script type="text/javascript">
										var autoDownload = "{{widgetVO.autoDownload}}";
										if (autoDownload == "true") {
											jQuery("#autoDownload").text("是");
										} else {
											jQuery("#autoDownload").text("否");

										}
									</script>
								</li>

								<li id="localStr" style="display: none;">local标识：<span
									id="localSpan"></span> <script type="text/javascript">
										var localstr = "{{widgetVO.local}}";
										if ("" != localstr) {
											jQuery("#localSpan").text(localstr);
											jQuery("#localStr").show();
										}
									</script>
								</li>

								<li id="isAutoShowLi">是否自动打开：<span id="isAutoShow"></span>
									<script type="text/javascript">
										var isAutoShow = "{{widgetVO.autoShow}}";
										if (isAutoShow == "true") {
											jQuery("#isAutoShow").text("是");
										} else {
											jQuery("#isAutoShow").text("否");
										}
									</script>
								</li>

								<li id="timeUnitLi">单位时间：<span id="timeUnitSpan"></span> <script
										type="text/javascript">
									var timeUnit = "{{widgetVO.timeUnit}}";
									if (timeUnit == "H") {
										jQuery("#timeUnitSpan").text("小时");
									} else if (timeUnit == "M") {
										jQuery("#timeUnitSpan").text("分钟");
									} else {
										jQuery("#timeUnitSpan").text("秒");
									}
								</script>
								</li>

								<li id="showIntervalTimeLi">时间间隔：<span
									id="showIntervalTime"></span> <script type="text/javascript">
										var showIntervalTime = "{{widgetVO.showIntervalTime}}";
										jQuery("#showIntervalTime").text(
												showIntervalTime);
									</script>
								</li>
								<li>权重值：<span>{{widgetVO.sortingWeight}}</span></li>
								<li>模块简介：<span style="width: 100%; word-wrap: break-word;">{{widgetVO.discription}}</span></li>
							</ul>
						</div>
					</div>
				</div>
				<div class="hr-10"></div>
			</div>
		</div>
	</div>
	<div class="container bor-tab bg-st-white ">

		<div class="tit2-st">历史版本</div>
		<div class="text-right pad-st-b5" id="newVersionDiv">
			<a class="btn btn-primary btn-small tls"
				href="javascript:versionAdd('{{widgetVO.id}}')">新建版本</a>
		</div>
		<div class="bor-top">
			<div class="bor-top">
				{{#listVersion}}
				<div class="col-1 text-center pad-st-b10 bor-bot" id="noIcon"
					style="float: left;">
					<ul style="list-style: none; padding: 0; margin: 0;">
						<li style=""><a href="javascript:showVersionView('{{id}}');">
								<img class="img-rounded info-icon" id="noIcon{{id}}"
								style="height: 72px; width: 72px;" />
								<p>
									<strong>{{version}}</strong>
								</p>
						</a></li>
						<li id="cloneLink"><a
							href="javascript:showCloneView('{{id}}');"
							class="btn btn-common btn-small tls"><strong>克
									&nbsp;&nbsp;隆</strong> </a></li>
					</ul>
				</div>
				<script type="text/javascript">
					var icon = "{{widgetVO.icon_id}}";
					if (icon != "") {
						jQuery("#noIcon{{id}}")
								.attr("src",
										"{{ctx}}/mam/attachment/download/{{widgetVO.icon_id}}");
					} else {
						jQuery("#noIcon{{id}}").attr("src",
								"{{ctx}}/static/bsl/images/defind.png");
					}
				</script>
				{{/listVersion}}

			</div>
			<div class="hr"></div>
		</div>
	</div>
	<!--boostrap 弹框 -->
	{{>/WEB-INF/pages/app/widget-modal.html}}
	{{>/WEB-INF/pages/common/layout_footer.part.html}}

</body>
</html>
<script type="text/javascript">
	$(function() {
		var locals = "{{widgetVO.local}}";
		if ("" != locals) {
			$("#newVersionDiv").hide();
			$("#cloneLink").hide();
			$("#isAutoShowLi").hide();
			$("#autoDownloadLi").hide();
		}

		if ('{{widgetVO.autoShow}}' == 'false') {
			$("#timeUnitLi").hide();
			$("#showIntervalTimeLi").hide();
		}

	});

	function versionAdd(id) {
		window.location.href = "{{ctx}}/mam/widgetVersion/add-view?widgetID="
				+ id;
	}

	//编辑
	function widgetEdit(widgetId) {
		var loadurl = '{{ctx}}/mam/widget/update-view/' + widgetId;
		$.get(loadurl, function(data) {
			bootbox.dialog({
				message : data,
				title : "模块编辑",
				buttons : {
					danger : {
						label : "关闭",
						className : "btn btn-common btn-small tls"
					},
					success : {
						label : "保存",
						className : "btn btn-primary btn-small tls",
						callback : function() {
							formSubmit();
							return false;
						}
					}
				}
			});
		});
	}
	function showVersionView(id) {
		window.location.href = "{{ctx}}/mam/widgetVersion/view?id=" + id;
	}

	function deleteWidget(id) {
		bootbox
				.confirm(
						"确定要删除吗?",
						function(result) {
							if (result) {
								$
										.ajax({
											type : "GET",
											dataType : "json",
											url : "{{ctx}}/mam/widget/delete?id="
													+ id,
											success : function(data, textStatus) {
												if (data.result == "success") {
													window.location.href = "{{ctx}}/mam/widget/list-view";
												} else {
													bootbox
															.alert("删除失败，请稍后再试！");
												}
											},
											error : function(data, status, e) {
												bootbox.alert("系统繁忙，请稍后再试！");
											}
										});
							}
						});
	}

	function showCloneView(id) {
		var loadurl = '{{ctx}}/mam/widgetVersion/showCloneView/' + id;
		$.get(loadurl, function(data) {
			bootbox.dialog({
				message : data,
				title : "克隆模块",
				buttons : {
					danger : {
						label : "关闭",
						className : "btn btn-common btn-small tls"
					},
					success : {
						label : "保存",
						className : "btn btn-primary btn-small tls",
						callback : function() {
							widgetCloneSbumit();
							return false;
						}
					}
				}
			});
		});
	}
</script>
